<?php
namespace app\admin\validate;
use think\Validate;

class Conf extends Validate
{
   protected $rule = [
        'cname'  =>  'require|max:60|unique:conf',
        'ename'  =>  'require|max:60|unique:conf',
        'dc_type' => 'require|number',
        'cf_type' => 'require|number',
    ];

    protected $message = [
        'ename.require' => '英文名称必须填写',
        'cname.require' => '中文名称必须填写',
        'cname.max' => '最大长度为60',
        'ename.max' => '最大长度为60',
        'ename.unique' => '该英文名称已经存在',
        'cname.unique' => '该中文名称已经存在',
        'dc_type.require' => '配置类型必须选择',
        'cf_type.require' => '配置分类必须选择',
        'dc_type.number' => '必须位数字',
        'cf_type.number' => '必须位数字',
    ];

    protected $scene = [
        'add'=>['cname','ename','dc_type','cf_type'],
        'edit'=>['cname','ename','dc_type','cf_type'],

    ];
    
}
